package cz.cuni.amis.episodic.lisp.netcreators;

import java.util.List;

import cz.cuni.amis.episodic.lisp.TraceUtils;

import lombok.AllArgsConstructor;

/**
 * Discards all elements of trace with exception of N upper elements and the last element - observation. 
 * @author ik
 *
 */
@AllArgsConstructor
public class UpperTraceAndObservationStrategy implements TraceModificationStrategy {

	int depth;
	
	@Override
	public <T> List<T[]> modifyTrace(List<T[]> traces, boolean countLast) {
		int N = depth;
		if(countLast) N++;
		List<T[]> tr;
		if(countLast) {
			tr = TraceUtils.trimTraceLeaveLast(traces, N);
		} else {
			tr = TraceUtils.trimTrace(traces, N);
		}
		tr = TraceUtils.padDown(tr, N);
		return tr;
	}
	
	@Override
	public int getDepth() {
		return depth;
	}

	@Override
	public int getBatchSize() {
		return -1;
	}
}
